package com.stox.ui.swing.view;

import java.awt.BorderLayout;

import com.stox.ui.swing.widget.JTreeSearchPanel;
import com.stox.ui.swing.widget.wrapper.JPanel;
import com.stox.ui.swing.widget.wrapper.JTree;

public abstract class AbstractNavigatorTab extends JPanel implements NavigatorTab{
	private static final long serialVersionUID = -8376273778431027138L;

	private boolean initialized = false;

	@Override
	public boolean isInitialized() {
		return initialized;
	}
	
	@Override
	public void initialize() {
		synchronized(this){
			if(!initialized){
				initializeInternal();
				add(new JTreeSearchPanel(getJTree()), BorderLayout.SOUTH);
			}
			initialized = true;
		}
	}
	
	protected abstract void initializeInternal();
	
	protected abstract JTree getJTree();

}
